home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 2,801 to 2,900 / aol-file-protocol-4400-2801-to-2900.zip / AOLDLs / C++ Files Library / Graphic Gems I, II & III (C_C++) / Graphics Gems C Code.sea / GemsI / Src / AALines / AALines.h < prev    next >
Text File  |  1992-06-16  |  1KB  |  47 lines

  1. /*  FILENAME:  AALines.h  [revised 17 AUG 90]
  2.  
  3.     AUTHOR:  Kelvin Thompson
  4.  
  5.     DESCRIPTION:  Symbols and globals for the anti-aliased line
  6.       renderer.
  7.  
  8.     #INCLUDED IN:
  9.       AAMain.c -- Calling routine for renderer.
  10.       AATables.c -- Initialization routines for lookup tables.
  11.       AALines.c -- Rendering code.
  12. */
  13.  
  14. /* frame buffer to hold the anti-aliased line */
  15. #define xpix 60
  16. #define ypix 60
  17. extern char *fbuff;
  18.  
  19. /* macros to access the frame buffer */
  20. #define PIXADDR(xx,yy) (fbuff+(yy)*xpix+(xx))
  21. #define PIXINC(dx,dy)  ((dy)*xpix+(dx))
  22.  
  23. /* fixed-point data types and macros */
  24. typedef int FX;
  25. typedef unsigned int UFX;
  26. #define FX_FRACBITS 16  /* bits of fraction in FX format */
  27. #define FX_0        0   /* zero in fixed-point format */
  28. #define FLOAT_TO_FX(flt)  ((FX)((flt)*(1<<FX_FRACBITS)+0.5))
  29.  
  30. /* some important constants */
  31. #define PI      3.1415926535897932384626433832795028841971693993751
  32. #define SQRT_2  1.4142135623730950488016887242096980785696718753769
  33.  
  34. /* square-root function globals */
  35. extern UFX *sqrtfunc;
  36. extern int sqrtcells;
  37. extern int sqrtshift;
  38. #define SQRTFUNC(fxval)  (sqrtfunc[ (fxval) >> sqrtshift ])
  39.  
  40. /* AA globals */
  41. extern float line_r;  /* line radius */
  42. extern float pix_r;   /* pixel radius */
  43. extern FX *coverage;
  44. extern int covercells;
  45. extern int covershift;
  46. #define COVERAGE(fxval) (coverage[ (fxval) >> covershift ])
  47.